package org.rcloud.io;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.rcloud.io.Utils.CookieUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
/*
 * Created by Administrator on 2019/3/15.
*/


@Component
public class LJQHandlerInterceptor implements HandlerInterceptor {

	 /* 视图渲染之后的操作*/


    @Override
    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3) throws Exception {

    }

    /* 处理请求完成后视图渲染之前的处理操作*/


    @Override
    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3) throws Exception {

    }

     /* 进入controller层之前拦截请求*/


    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {

          /* String cookie =  CookieUtils.getCookie(request, (String) obj);
           if(cookie != ""){
               return true;
           }else{
               return false;
           }*/
          return true;
    }
}
